﻿using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using SmartCity.Shared;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;

namespace CommonManagement
{
    /// <summary>
    /// 天气控制器
    /// </summary>
    [RemoteService]
    [Area("commonManagement")]
    [Route("api/commonManagement/weather")]
    public class WeatherController : AbpController, IWeatherAppService
    {
        private readonly IWeatherAppService _weatherAppService;

        public WeatherController(
            IWeatherAppService weatherAppService)
        {
            _weatherAppService = weatherAppService;
        }

        // 当天天气
        [HttpGet]
        [Route("today")]
        public Task<ResultResponse<WeatherDto>> TodayAsync()
        {
            return _weatherAppService.TodayAsync();
        }

        // 预报天气
        [HttpGet]
        [Route("")]
        public Task<ResultResponse<ForecastDto>> ForecastAsync()
        {
            return _weatherAppService.ForecastAsync();
        }
    }
}